<!-- Brand Logo -->
<a data-url="member/index" class="brand-link">
    <img src="../../../images/logo.jpg" alt="AdminLTE Logo" class="brand-image img-circle elevation-3"
        style="opacity: .8" >
    <span class="brand-text font-weight-light">计算机维护队</span>
</a>

<!-- Sidebar -->
<div class="sidebar">
    <!-- Sidebar Menu -->
    <div class="user-panel mt-3 pb-3 mb-3 d-flex">
        <div class="image">
            <img data-url="dist/img/user2-160x160.jpg" class="img-circle elevation-2" alt="User Image" id="profile">
        </div>
        <div class="info">
            <a  class="d-block">百度WF</a>
        </div>
    </div>
    <nav class="mt-2">
        <ul class="nav nav-pills nav-sidebar flex-column nav-child-indent" data-widget="treeview" role="menu"
            data-accordion="false">
            <li class="nav-item has-treeview">
                <a data-url="#" onclick="return false" class="nav-link" id="personalCenter">
                    <i class="nav-icon fas fa-user"></i>
                    <p>
                        个人中心
                        <i class="right fas fa-angle-left"></i>
                    </p>
                </a>
                <ul class="nav nav-treeview">

                    <li class="nav-item">
                        <a data-url="member/personalInfoPage" class="nav-link" id="personalInfoPage">
                            <i class="far fa-circle nav-icon"></i>
                            <p>个人信息</p>
                        </a>
                    </li>
                    <li class="nav-item">
                        <a data-url="member/myTaskList" class="nav-link" id="myTaskList">
                            <i class="far fa-circle nav-icon"></i>
                            <p>我的任务</p>
                        </a>
                    </li>
                    <li class="nav-item">
                        <a data-url="member/changePassword" class="nav-link" id="changePassword">
                            <i class="far fa-circle nav-icon"></i>
                            <p>修改密码</p>
                        </a>
                    </li>
                    <li class="nav-item">
                        <a data-url="member/getWaitingReturnList" class="nav-link" id="getWaitingReturnList">
                            <i class="far fa-circle nav-icon"></i>
                            <p>待归还物资</p>
                        </a>
                    </li>
                </ul>
            </li>

            <li class="nav-item has-treeview" >
                <a data-url="" onclick="return false" class="nav-link" id="materials">
                    <i class="nav-icon fas fa-boxes"></i>
                    <p>
                        图书资源
                        <i class="right fas fa-angle-left"></i>
                    </p>
                </a>
                <ul class="nav nav-treeview">
                    <li class="nav-item">
                        <a data-url="member/getCanBorrowItemList" class="nav-link" id="getCanBorrowItemList">
                            <i class="far fa-circle nav-icon"></i>
                            <p>物资借用</p>
                        </a>
                    </li>
                    <li class="nav-item">
                        <a data-url="member/getCanBorrowBook" class="nav-link" id="getCanBorrowBook">
                            <i class="far fa-circle nav-icon"></i>
                            <p>图书借用</p>
                        </a>
                    </li>
                </ul>
            </li>

            <li class="nav-item has-treeview" >
                <a data-url="member/editor"  class="nav-link" id="blog">
                    <i class="nav-icon fas fa-edit"></i>
                    <p>
                        我的博客
                        <!-- <i class="right fas fa-angle-left"></i> -->
                    </p>
                </a>
            </li>


        </ul>
    </nav>
    <!-- /.sidebar-menu -->
</div>
<!-- /.sidebar -->
<script>
    function getContextPath() {
        var curWwwPath = document.location.href;
        var pathName = document.location.pathname;     
        var pos = curWwwPath.indexOf(pathName);
        var localhostPath = curWwwPath.substring(0,pos);
        return localhostPath;
        // return "C:\\Users\\zhuoQiang\\Desktop\\web\\proj"
    }

    function getChildID(){
        var name = document.location.pathname.split("/").pop()
        return name.split(".")[0]
    }
    // function getParentID(){
    //     return document.location.pathname.split("/")[document.location.pathname.split("/").length-2]
    // }
    $("#" + getChildID()).addClass("active")
    $("#" + getChildID()).parent().parent().prev().addClass("active").parent().addClass("menu-open")
    $(".brand-link").attr("href", getContextPath() + "\/"+ $(".brand-link").data("url"))
    $("#profile").attr("src", getContextPath() + "\/"+ $("#profile").data("url"))
    $(".nav-link").each(function(){
        $(this).attr("href", getContextPath() + "\/"+  $(this).data("url"))
    })
</script>